package com.aspose.cells;

import java.util.ArrayList;

class zauz {
   private zbwo a;
   private byte[] b = new byte[2];
   private zpb c;
   private int d;
   private byte[] e;
   private int f;
   private PivotTable g;
   private WorksheetCollection h;
   private Worksheet i;
   private PivotField j;
   private int k;
   private int l;
   private int m;
   private int n;
   private int o;
   private int p;

   void a(WorksheetCollection var1, Worksheet var2, zbwo var3, zpb var4) throws Exception {
      this.i = var2;
      this.h = var1;
      this.c = var4;
      this.a = var3;
      this.g = new PivotTable(var2.getPivotTables());
      this.g.s = true;
      var2.getPivotTables().a(this.g);
      boolean var5 = this.f();
      if (!var5) {
         this.d = 176;
         this.e();
      } else {
         boolean var6 = true;
         boolean var7 = true;

         while(true) {
            this.d = var4.b(this.b);
            switch(this.d) {
            case 10:
            case 176:
            case 236:
            case 574:
            default:
               var4.a(-2);
               return;
            case 177:
               this.j();
               break;
            case 180:
               this.b(var6);
               var6 = false;
               break;
            case 181:
               this.a(var7);
               var7 = false;
               break;
            case 182:
               this.h();
               break;
            case 197:
               this.i();
               break;
            case 241:
               this.g();
               break;
            case 2050:
               this.c();
               break;
            case 2064:
               this.d();
               break;
            case 2148:
               this.b();
            }
         }
      }
   }

   private void a() throws Exception {
      this.k();
      zbqy var1 = new zbqy(this.g.ag);
      var1.a = (byte)(this.e[0] & 255 & 15);
      int var2 = com.aspose.cells.b.a.zc.e(this.e, 2) & '\uffff';
      this.d = this.c.b(this.b);
      if ((this.d & '\uffff') != 240) {
         this.c.a(-2);
      } else {
         this.k();
         zbro var3 = new zbro();
         var1.c = var3;
         var3.a = this.e[0];
         var3.b = this.e[1];
         var3.c = com.aspose.cells.b.a.zc.e(this.e, 2);
         int var4 = com.aspose.cells.b.a.zc.e(this.e, 6) & '\uffff';
         if (var3.j() && this.e.length == 12) {
            var3.f = this.e[8];
            var3.g = this.e[9];
            var3.h = this.e[10];
            var3.i = this.e[11];
         }

         for(int var5 = 0; var5 < var4; ++var5) {
            this.d = this.c.b(this.b);
            if ((this.d & '\uffff') != 242) {
               this.c.a(-2);
               return;
            }

            this.k();
            zbqw var6 = new zbqw();
            com.aspose.cells.b.a.a.ze.a(var3.e, (Object)var6);
            var6.a = com.aspose.cells.b.a.zc.e(this.e, 0);
            var6.b = com.aspose.cells.b.a.zc.e(this.e, 2);
            var6.a(com.aspose.cells.b.a.zc.e(this.e, 4));
            int var7 = com.aspose.cells.b.a.zc.e(this.e, 6) & '\uffff';
            if (var7 > 0) {
               this.d = this.c.b(this.b);
               if ((this.d & '\uffff') != 245) {
                  this.c.a(-2);
                  return;
               }

               this.k();
               int var8 = 0;

               for(int var9 = 0; var9 < var7 && var8 < this.e.length; ++var9) {
                  com.aspose.cells.b.a.a.ze.a(var6.c, (Object)(com.aspose.cells.b.a.zc.e(this.e, var8) & '\uffff'));
                  var8 += 2;
               }
            }
         }

         this.d = this.c.b(this.b);
         if ((this.d & '\uffff') == 244) {
            this.k();
            byte var10 = 0;
            Style var12 = new Style(this.h);
            if (this.e != null) {
               int[] var13 = new int[]{var10};
               this.a(this.e, var13, var12);
               int var11 = var13[0];
               var1.a(var12);
            }

            this.g.ag.a(var1);
         } else {
            this.c.a(-2);
         }
      }
   }

   private void a(byte[] var1, int[] var2, Style var3) throws Exception {
      int var4 = var2[0];
      long var5 = com.aspose.cells.b.a.zc.d(var1, var4);
      var4 += 4;
      int var7 = com.aspose.cells.b.a.zc.e(var1, var4);
      boolean var8 = (var1[var4] & 255 & 1) != 0;
      var4 += 2;
      if ((var5 & 4294967295L) != 0L) {
         int var9;
         int var10;
         if ((var5 & 4294967295L & 33554432L) != 0L) {
            if (!var8) {
               var9 = var1[var4 + 1] & 255;

               for(var10 = 0; var10 < this.h.A().size(); ++var10) {
                  zxw var11 = (zxw)this.h.A().get(var10);
                  if (var11.b() == var9) {
                     if (var11.a() != null && !"".equals(var11.a())) {
                        var3.setCustom(var11.a());
                     }
                     break;
                  }
               }

               var3.setNumber(var9);
               if (var3.getNumber() == 14) {
                  var3.setCustom("0.00%");
               }

               var4 += 2;
            } else {
               short var16 = com.aspose.cells.b.a.zc.b(this.e, var4);
               var4 += 2;
               if (var16 > 0) {
                  short var18 = com.aspose.cells.b.a.zc.b(this.e, var4);
                  var4 += 2;
                  if (var18 > 0) {
                     int[] var20 = new int[]{var4};
                     var3.setCustom(this.a(var20, var18));
                     var4 = var20[0];
                  }
               }
            }
         }

         boolean var12;
         boolean var13;
         boolean var17;
         if ((var5 & 4294967295L & 67108864L) != 0L) {
            var17 = com.aspose.cells.b.a.zc.a(var1, var4 + 92) == 0;
            boolean var19 = com.aspose.cells.b.a.zc.a(var1, var4 + 96) == 0;
            boolean var21 = com.aspose.cells.b.a.zc.a(var1, var4 + 100) == 0;
            var12 = (var1[var4 + 88] & 255 & 2) == 0;
            var13 = (var1[var4 + 88] & 255 & 128) == 0;
            int var14 = com.aspose.cells.b.a.zc.a(var1, var4 + 64);
            if (var14 != -1) {
               var3.getFont().setSize((short)(var14 / 20));
            }

            if (var12) {
               var3.getFont().setItalic((var1[var4 + 68] & 255 & 2) != 0);
            }

            if (var21) {
               var3.getFont().b(com.aspose.cells.b.a.zc.e(var1, var4 + 72) & '\uffff');
            }

            if (var13) {
               var3.getFont().setStrikeout((var1[var4 + 68] & 255 & 128) != 0);
            }

            if (var17) {
               short var15 = com.aspose.cells.b.a.zc.b(var1, var4 + 74);
               switch(var15) {
               case 1:
                  var3.getFont().setSuperscript(true);
                  break;
               case 2:
                  var3.getFont().setSubscript(true);
               }
            }

            if (var19) {
               switch(var1[var4 + 76]) {
               case 0:
                  var3.getFont().setUnderline(0);
                  break;
               case 1:
                  var3.getFont().setUnderline(1);
                  break;
               case 2:
                  var3.getFont().setUnderline(2);
                  break;
               case 33:
                  var3.getFont().setUnderline(3);
                  break;
               case 34:
                  var3.getFont().setUnderline(4);
               }
            }

            var14 = com.aspose.cells.b.a.zc.a(var1, var4 + 80);
            if (var14 != -1) {
               var3.getFont().setColor(this.h.m().e(var14));
            }

            var4 += 118;
         }

         if ((var5 & 4294967295L & 134217728L) != 0L) {
            if ((var5 & 4294967295L & 1L) == 0L) {
               var3.setHorizontalAlignment(zsk.a(var1[var4] & 255 & 7, false));
            }

            if ((var5 & 4294967295L & 2L) == 0L) {
               var3.setVerticalAlignment(zsk.a((var1[var4] & 255 & 112) >> 4, true));
            }

            if ((var5 & 4294967295L & 4L) == 0L) {
               var3.setTextWrapped((var1[var4] & 255 & 8) != 0);
            }

            if ((var5 & 4294967295L & 8L) == 0L) {
               var3.setRotationAngle(var1[var4 + 1]);
            }

            if ((var5 & 4294967295L & 16L) == 0L) {
               ;
            }

            if ((var5 & 4294967295L & 32L) == 0L) {
               var9 = var1[var4 + 2] & 255 & 15;
               var10 = var1[var4 + 4] & 255;
               if (var10 != 255) {
                  var3.setIndentLevel(var10);
               } else {
                  var3.setIndentLevel(var9);
               }
            }

            if ((var5 & 4294967295L & 64L) == 0L) {
               var3.setShrinkToFit((var1[var4 + 2] & 255 & 16) != 0);
            }

            if ((var5 & 4294967295L & 128L) == 0L) {
               ;
            }

            if ((var5 & 4294967295L & 2147483648L) == 0L) {
               switch((var1[var4 + 2] & 255 & 192) >> 6) {
               case 0:
                  var3.setTextDirection(0);
                  break;
               case 1:
                  var3.setTextDirection(1);
                  break;
               case 2:
                  var3.setTextDirection(2);
               }
            }

            var4 += 8;
         }

         if ((var5 & 4294967295L & 268435456L) != 0L) {
            if ((var7 & '\uffff' & 4) != 0) {
               var3.getBorders().a = true;
            }

            var9 = com.aspose.cells.b.a.zc.e(var1, var4);
            long var22 = (long)(com.aspose.cells.b.a.zc.e(var1, var4 + 2) & '\uffff');
            var12 = false;
            var13 = false;
            boolean var24 = false;
            int var23;
            if ((var5 & 4294967295L & 1024L) == 0L) {
               var3.getBorders().getByBorderType(1).setLineStyle(var9 & '\uffff' & 15);
               var23 = (int)(var22 & 4294967295L & 63L);
               var3.getBorders().getByBorderType(1).setColor(this.h.m().e(var23));
            }

            if ((var5 & 4294967295L & 2048L) == 0L) {
               var3.getBorders().getByBorderType(2).setLineStyle((var9 & '\uffff' & 240) >> 4);
               var23 = (int)((var22 & 4294967295L & 1016L) >> 7);
               var3.getBorders().getByBorderType(2).setColor(this.h.m().e(var23));
            }

            var13 = (var22 & 4294967295L & 16384L) != 0L;
            var24 = (var22 & 4294967295L & 32768L) != 0L;
            var22 = com.aspose.cells.b.a.zc.d(var1, var4 + 4);
            if ((var5 & 4294967295L & 4096L) == 0L) {
               var3.getBorders().getByBorderType(4).setLineStyle((var9 & '\uffff' & 3840) >> 8);
               var23 = (int)(var22 & 4294967295L & 16128L);
               var3.getBorders().getByBorderType(4).setColor(this.h.m().e(var23));
            }

            if ((var5 & 4294967295L & 8192L) == 0L) {
               var3.getBorders().getByBorderType(8).setLineStyle((var9 & '\uffff' & '\uf000') >> 12);
               var23 = (int)((var22 & 4294967295L & 1016L) >> 7);
               var3.getBorders().getByBorderType(8).setColor(this.h.m().e(var23));
            }

            if ((var5 & 4294967295L & 16384L) == 0L && var13) {
               var3.getBorders().getByBorderType(16).setLineStyle((int)((var22 & 4294967295L & 31457280L) >> 21));
               var23 = (int)((var22 & 4294967295L & 130048L) >> 14);
               var3.getBorders().getByBorderType(16).setColor(this.h.m().e(var23));
            }

            if ((var5 & 4294967295L & 32768L) == 0L && var24) {
               var3.getBorders().getByBorderType(32).setLineStyle((int)((var22 & 4294967295L & 31457280L) >> 21));
               var23 = (int)((var22 & 4294967295L & 130048L) >> 14);
               var3.getBorders().getByBorderType(32).setColor(this.h.m().e(var23));
            }

            var4 += 8;
         }

         if ((var5 & 4294967295L & 536870912L) != 0L) {
            if ((var5 & 4294967295L & 65536L) == 0L) {
               var3.setPattern((var1[var4 + 1] & 255) >> 2);
            }

            var17 = false;
            if ((var5 & 4294967295L & 131072L) == 0L) {
               var9 = var1[var4 + 2] & 255 & 127;
               var3.setForegroundColor(this.h.m().e(var9));
            }

            if ((var5 & 4294967295L & 262144L) == 0L) {
               var9 = (com.aspose.cells.b.a.zc.e(var1, var4 + 2) & '\uffff' & 16256) >> 7;
               var3.setBackgroundColor(this.h.m().e(var9));
            }

            var4 += 4;
         }

         if ((var5 & 4294967295L & 1073741824L) != 0L) {
            if ((var5 & 4294967295L & 256L) == 0L) {
               var3.setLocked((var1[var4] & 255 & 1) != 0);
            }

            if ((var5 & 4294967295L & 512L) == 0L) {
               var3.setFormulaHidden((var1[var4] & 255 & 2) != 0);
            }

            var4 += 2;
         }

         var2[0] = var4;
      }
   }

   private void b() throws Exception {
      this.k();
      byte[] var1 = new byte[this.e.length - 4];
      System.arraycopy(this.e, 4, var1, 0, var1.length);
      this.g.ab.a(var1);
      byte var2;
      int var7;
      if (this.e[4] == 0) {
         if (this.e[5] == 30) {
            var2 = 14;
            short var3 = com.aspose.cells.b.a.zc.b(this.e, var2);
            if (var3 > 0) {
               var7 = var2 + 2;
               int[] var4 = new int[]{var7};
               this.g.setPivotTableStyleName(this.b(var4, var3));
               var7 = var4[0];
            }
         } else if (this.e[5] == 2) {
            if ((this.e[7] & 255 & 4) != 0) {
               this.g.setEnableFieldList(false);
            } else {
               this.g.setEnableFieldList(true);
            }
         }
      } else {
         int var10;
         if (this.e[4] == 23) {
            PivotField var8 = null;
            if (this.e[5] == 0) {
               byte var9 = 12;
               short var12 = com.aspose.cells.b.a.zc.b(this.e, var9);
               if (var12 > 0) {
                  var10 = var9 + 2;
                  int[] var5 = new int[]{var10};
                  String var6 = this.a(var5, var12);
                  var10 = var5[0];
                  var8 = this.g.getBaseFields().get(var6);
               }

               this.d = this.c.b(this.b);
               switch(this.d) {
               case 2148:
                  this.k();
                  var1 = new byte[this.e.length - 4];
                  System.arraycopy(this.e, 4, var1, 0, var1.length);
                  this.g.ab.a(var1);
                  if (this.e[5] == 25 && var8 != null) {
                     if ((this.e[6] & 255 & 32) != 0) {
                        var8.setIncludeNewItemsInFilter(false);
                     } else {
                        var8.setIncludeNewItemsInFilter(true);
                     }

                     if ((this.e[6] & 255 & 8) != 0) {
                        var8.setShowCompact(true);
                     } else {
                        var8.setShowCompact(false);
                     }
                  }

                  return;
               default:
                  this.c.a(-2);
                  return;
               }
            }
         } else if (this.e[4] == 29) {
            boolean var11 = false;
            if (this.e[5] == 56) {
               var2 = 6;
               var10 = com.aspose.cells.b.a.zc.a(this.e, var2);
               this.g.ak = this.g.getBaseFields().get(var10);
            } else if (this.e[5] == 60) {
               var2 = 20;
               var7 = var2 + 6;
               double var13 = com.aspose.cells.b.a.zc.f(this.e, var7);
               if (this.g.ak != null) {
                  this.g.ak.f = (int)var13;
               }
            }
         }
      }

   }

   private void c() throws Exception {
      this.k();
      zbrq var1 = new zbrq();
      this.g.Z = var1;
      var1.b = new byte[14];
      System.arraycopy(this.e, 2, var1.b, 0, 14);
      byte var2 = 16;
      short var3 = com.aspose.cells.b.a.zc.b(this.e, var2);
      int var5 = var2 + 2;
      int[] var4 = new int[]{var5};
      var1.a = this.a(var4, var3);
      var5 = var4[0];
      var1.c = com.aspose.cells.b.a.zc.e(this.e, var5);
   }

   private void d() throws Exception {
      this.k();
      zbrx var1 = this.g.e;
      var1.a = com.aspose.cells.b.a.zc.a(this.e, 8);
      var1.b(zauw.a(com.aspose.cells.b.a.zc.e(this.e, 12)));
      short var2 = com.aspose.cells.b.a.zc.b(this.e, 14);
      if (var2 > 0) {
         byte var3 = 16;
         int[] var4 = new int[]{var3};
         var1.b = this.a(var4, var2);
         int var5 = var4[0];
      }

   }

   private void a(boolean var1) throws Exception {
      this.k();
      boolean var2 = false;
      ArrayList var4 = null;
      int var3;
      int var10;
      if (var1) {
         var10 = this.k;
         this.g.g = var4 = new ArrayList(var10);
         var3 = this.m;
      } else {
         var10 = this.l;
         this.g.h = var4 = new ArrayList(var10);
         var3 = this.n;
      }

      int var5 = 0;
      int var6 = 4 + var3;
      Object var7 = null;

      for(int var8 = 0; var8 < var10; ++var8) {
         int var9;
         int[] var11;
         if (var5 + var6 * 2 > this.e.length) {
            var11 = new int[var6];
            com.aspose.cells.b.a.a.ze.a(var4, (Object)var11);

            for(var9 = 0; var5 < this.e.length; var5 += 2) {
               var11[var9++] = com.aspose.cells.b.a.zc.b(this.e, var5);
            }

            this.d = this.c.b(this.b);
            if ((this.d & '\uffff') != 60) {
               this.c.a(-2);
               return;
            }

            this.k();

            for(var5 = 0; var9 < var6; ++var9) {
               var11[var9] = com.aspose.cells.b.a.zc.b(this.e, var5);
               var5 += 2;
            }

            if (var5 == this.e.length && (this.c.b(this.b) & '\uffff') == 181) {
               this.c.a(-2);
               return;
            }
         }

         var11 = new int[var6];
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var11);

         for(var9 = 0; var9 < var11.length; ++var9) {
            var11[var9] = com.aspose.cells.b.a.zc.b(this.e, var5);
            var5 += 2;
         }
      }

   }

   private void e() throws Exception {
      byte[] var1 = new byte[this.e.length + 4];
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.d), 0, var1, 0, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)this.e.length), 0, var1, 2, 2);
      System.arraycopy(this.e, 0, var1, 4, this.e.length);
      ArrayList var2 = new ArrayList();
      com.aspose.cells.b.a.a.ze.a(var2, (Object)var1);
      this.g.Y = var2;

      while(true) {
         this.d = this.c.b(this.b);
         switch(this.d) {
         case 10:
         case 176:
         case 574:
            this.c.a(-2);
            return;
         default:
            this.l();
            com.aspose.cells.b.a.a.ze.a(var2, (Object)this.e);
         }
      }
   }

   private boolean f() throws Exception {
      this.k();
      boolean var1 = false;
      int var2 = com.aspose.cells.b.a.zc.e(this.e, 14) & '\uffff';
      if (this.h.U().getCount() > 0) {
         zauk var3 = this.h.U().a(var2);
         ++var3.o;
         switch(var3.d) {
         case 1:
         case 4:
            zaum var4 = new zaum();
            var4.b(var3, this.i, this.a);
            this.g.d = var3;
            this.g.d.u = var2;
            break;
         default:
            zaum var5 = new zaum();
            var5.a(var3, this.i, this.a);
            this.a(var3);
            var1 = true;
         }
      }

      this.g.u = true;
      this.g.v = true;
      this.g.w = false;
      this.g.x = false;
      this.g.i = com.aspose.cells.b.a.zc.e(this.e, 0) & '\uffff';
      this.g.j = com.aspose.cells.b.a.zc.e(this.e, 2) & '\uffff';
      this.g.k = this.e[4] & 255;
      this.g.l = this.e[6] & 255;
      this.g.m = com.aspose.cells.b.a.zc.e(this.e, 8) & '\uffff';
      this.g.n = com.aspose.cells.b.a.zc.e(this.e, 10) & '\uffff';
      this.g.o = this.e[12] & 255;
      this.m = com.aspose.cells.b.a.zc.e(this.e, 24) & '\uffff';
      this.n = com.aspose.cells.b.a.zc.e(this.e, 26) & '\uffff';
      this.o = com.aspose.cells.b.a.zc.e(this.e, 28) & '\uffff';
      this.p = com.aspose.cells.b.a.zc.e(this.e, 30) & '\uffff';
      this.k = com.aspose.cells.b.a.zc.e(this.e, 32) & '\uffff';
      this.l = com.aspose.cells.b.a.zc.e(this.e, 34) & '\uffff';
      this.g.b.i = com.aspose.cells.b.a.zc.e(this.e, 36);
      this.g.b.j = com.aspose.cells.b.a.zc.b(this.e, 38);
      int var8 = com.aspose.cells.b.a.zc.e(this.e, 40);
      int var9 = com.aspose.cells.b.a.zc.e(this.e, 42);
      byte var10 = 44;
      int var11;
      if (this.e[var10] == 0) {
         byte[] var6 = new byte[2 * (var8 & '\uffff')];

         for(int var7 = 0; var7 < (var8 & '\uffff'); ++var7) {
            var6[2 * var7] = this.e[var10 + 1 + var7];
         }

         this.g.b.g = Encoding.getUnicode().a(var6, 0, var6.length);
         var11 = var10 + (var8 & '\uffff') + 1;
      } else {
         this.g.b.g = Encoding.getUnicode().a(this.e, var10 + 1, (var8 & '\uffff') * 2);
         var11 = var10 + (var8 & '\uffff') * 2 + 1;
      }

      int var10000;
      if (this.e[var11] == 0) {
         this.g.b.h = Encoding.getASCII().a(this.e, var11 + 1, var9 & '\uffff');
         var10000 = var11 + (var9 & '\uffff') + 1;
      } else {
         this.g.b.h = Encoding.getUnicode().a(this.e, var11 + 1, (var9 & '\uffff') * 2);
         var10000 = var11 + (var9 & '\uffff') * 2 + 1;
      }

      if (this.p > 1) {
         this.j = new PivotField();
         this.j.t = -2;
         this.j.l = this.g;
         this.j.a = this.g.getBaseFields();
         this.j.k = this.j;
         this.g.f = this.j;
      }

      return !var1;
   }

   private void a(zauk var1) throws Exception {
      zvh var2 = this.a.b;
      zane var3 = var2.a().b("_SX_DB_CUR");
      if (var3 != null) {
         String var4 = com.aspose.cells.a.c.zp.d(var1.r);
         com.aspose.cells.b.a.d.zh var5 = var3.a(var4);
         if (var5 != null) {
            var3.g(var4);
         }
      }
   }

   private String a(int[] var1, int var2) throws Exception {
      String var3 = null;
      if (this.e[var1[0]] == 0) {
         var3 = Encoding.getASCII().a(this.e, var1[0] + 1, var2);
         var1[0] += var2 + 1;
      } else {
         var3 = Encoding.getUnicode().a(this.e, var1[0] + 1, var2 * 2);
         var1[0] += var2 * 2 + 1;
      }

      return var3;
   }

   private String b(int[] var1, int var2) throws Exception {
      String var3 = null;
      var3 = Encoding.getUnicode().a(this.e, var1[0], var2 * 2);
      var1[0] += var2 * 2;
      return var3;
   }

   private void g() throws Exception {
      this.k();
      zbqq var1 = this.g.c;
      var1.a = com.aspose.cells.b.a.zc.b(this.e, 0);
      short var2 = com.aspose.cells.b.a.zc.b(this.e, 2);
      short var3 = com.aspose.cells.b.a.zc.b(this.e, 4);
      short var4 = com.aspose.cells.b.a.zc.b(this.e, 6);
      var1.e = com.aspose.cells.b.a.zc.b(this.e, 8);
      var1.f = com.aspose.cells.b.a.zc.e(this.e, 14);
      var1.g = com.aspose.cells.b.a.zc.e(this.e, 16);
      short var5 = com.aspose.cells.b.a.zc.b(this.e, 18);
      short var6 = com.aspose.cells.b.a.zc.b(this.e, 20);
      short var7 = com.aspose.cells.b.a.zc.b(this.e, 22);
      int var8 = 24;
      int[] var9;
      if (var2 != -1) {
         var9 = new int[]{var8};
         var1.b = this.a(var9, var2);
         var8 = var9[0];
      }

      if (var3 != -1) {
         var9 = new int[]{var8};
         var1.c = this.a(var9, var3);
         var8 = var9[0];
      }

      if (var4 != -1) {
         var9 = new int[]{var8};
         var1.d = this.a(var9, var4);
         var8 = var9[0];
      }

      if (var5 != -1) {
         var9 = new int[]{var8};
         var1.h = this.a(var9, var5);
         var8 = var9[0];
      }

      if (var6 != -1) {
         var9 = new int[]{var8};
         var1.i = this.a(var9, var6);
         var8 = var9[0];
      }

      if (var7 != -1) {
         var9 = new int[]{var8};
         var1.j = this.a(var9, var7);
         var8 = var9[0];
      }

      if (var1.a + var1.e != 0) {
         ArrayList var10 = new ArrayList();
         var1.l = var10;

         while(true) {
            this.d = this.c.b(this.b);
            switch(this.d) {
            case 10:
            case 176:
            case 574:
            case 2050:
               this.c.a(-2);
               return;
            case 251:
               this.a();
               break;
            default:
               this.l();
               com.aspose.cells.b.a.a.ze.a(var10, (Object)this.e);
            }
         }
      }
   }

   private void b(boolean var1) throws Exception {
      this.k();
      PivotFieldCollection var2 = null;
      if (var1) {
         if (this.m != 0) {
            var2 = this.g.getRowFields();
         } else {
            var2 = this.g.getColumnFields();
         }
      } else {
         var2 = this.g.getColumnFields();
      }

      for(int var3 = 0; var3 < this.e.length; var3 += 2) {
         short var4 = com.aspose.cells.b.a.zc.b(this.e, var3);
         if (var4 < 0) {
            var2.a(this.j);
            this.j.m = var2.c;
         } else {
            PivotField var5 = this.g.getBaseFields().get(var4);
            var2.a(var5);
         }
      }

   }

   private void h() throws Exception {
      this.k();

      for(int var1 = 0; var1 < this.e.length; var1 += 6) {
         PivotField var2 = this.g.getBaseFields().get(com.aspose.cells.b.a.zc.e(this.e, var1) & '\uffff');
         this.g.getPageFields().a(var2);
         var2.j = new zbrl(var2);
         var2.j.b = com.aspose.cells.b.a.zc.b(this.e, var1 + 2);
         int var3 = com.aspose.cells.b.a.zc.e(this.e, var1 + 4) & '\uffff';
         this.i.getShapes().e(var3);
      }

   }

   private void i() throws Exception {
      this.k();
      PivotFieldCollection var1 = this.g.getDataFields();
      PivotField var2 = new PivotField();
      var2.a = var1;
      var2.a(var1.getCount());
      var1.a(var2);
      int var3 = com.aspose.cells.b.a.zc.e(this.e, 0) & '\uffff';
      var2.k = this.g.getBaseFields().get(var3);
      zbqn var4 = var2.i = new zbqn();
      var4.h = var2;
      switch(this.e[2]) {
      case 0:
         var4.a = 0;
         break;
      case 1:
         var4.a = 1;
         break;
      case 2:
         var4.a = 2;
         break;
      case 3:
         var4.a = 3;
         break;
      case 4:
         var4.a = 4;
         break;
      case 5:
         var4.a = 5;
         break;
      case 6:
         var4.a = 6;
         break;
      case 7:
         var4.a = 7;
         break;
      case 8:
         var4.a = 8;
         break;
      case 9:
         var4.a = 9;
         break;
      case 10:
         var4.a = 10;
      }

      var4.b = this.e[4] & 255;
      var4.c = com.aspose.cells.b.a.zc.b(this.e, 6);
      var4.d = com.aspose.cells.b.a.zc.b(this.e, 8);
      var4.e = com.aspose.cells.b.a.zc.b(this.e, 10);
      var4.f = this.h.h(var4.e);
      int var5 = com.aspose.cells.b.a.zc.e(this.e, 12);
      if (var5 != 65535) {
         var4.g = zco.a(this.e, 12);
      }

      if (this.j != null) {
         PivotItem var6 = new PivotItem(this.j.d);
         this.j.d.a(var6);
         var6.setIndex(var2.c());
         var6.e = var2;
      }

   }

   private void j() throws Exception {
      PivotField var1 = new PivotField(this.g.getBaseFields());
      var1.l = this.g;
      var1.t = this.g.getBaseFields().getCount();
      if (this.g.d != null && this.g.d.p != null && var1.t < this.g.d.p.size()) {
         var1.h = (zbqs)this.g.d.p.get(this.g.getBaseFields().getCount());
      }

      this.g.getBaseFields().a(var1);
      this.k();
      int var2 = com.aspose.cells.b.a.zc.e(this.e, 2) & '\uffff';
      var1.a((this.e[0] & 255 & 8) != 0);
      int var3 = this.e[0] & 255 & 15;
      if ((var3 & 1) != 0) {
         var1.m = 1;
      } else if ((var3 & 2) != 0) {
         var1.m = 2;
      } else if ((var3 & 4) != 0) {
         var1.m = 4;
      } else if ((var3 & 8) != 0) {
         var1.m = 8;
      }

      var1.b.a = com.aspose.cells.b.a.zc.e(this.e, 4);
      int var4 = com.aspose.cells.b.a.zc.e(this.e, 6) & '\uffff';
      int var5 = com.aspose.cells.b.a.zc.e(this.e, 8);
      if ((var5 & '\uffff') != 65535) {
         var1.b.b = zco.a(this.e, 8);
      }

      for(int var6 = 0; var6 < var4; ++var6) {
         this.d = this.c.b(this.b);
         if ((this.d & '\uffff') != 178) {
            this.c.a(-2);
            break;
         }

         this.k();
         if (this.e[0] == 0) {
            PivotItem var7 = new PivotItem(var1.getPivotItems());
            var1.getPivotItems().a(var7);
            var7.c = com.aspose.cells.b.a.zc.e(this.e, 2);
            var7.setIndex(com.aspose.cells.b.a.zc.e(this.e, 4));
            var5 = com.aspose.cells.b.a.zc.e(this.e, 6);
            if ((var5 & '\uffff') != 65535) {
               var7.d = zco.a(this.e, 6);
            }
         } else if (this.e[0] == 1) {
            ;
         }
      }

      this.d = this.c.b(this.b);
      if ((this.d & '\uffff') == 256) {
         this.k();
         zbrs var10 = var1.c;
         var10.a = com.aspose.cells.b.a.zc.e(this.e, 0);
         var10.b = this.e[2];
         var10.c = this.e[3];
         var10.h = com.aspose.cells.b.a.zc.b(this.e, 4);
         var10.i = com.aspose.cells.b.a.zc.b(this.e, 6);
         var10.d = com.aspose.cells.b.a.zc.b(this.e, 8);
         var10.e = this.h.h(var10.d);
         if (this.e.length > 10) {
            short var11 = com.aspose.cells.b.a.zc.b(this.e, 10);
            if (var11 != -1) {
               if (var11 + 21 <= this.e.length) {
                  byte[] var8 = new byte[2 * var11];

                  for(int var9 = 0; var9 < var11; ++var9) {
                     var8[2 * var9] = this.e[21 + var9];
                  }

                  var10.g = Encoding.getUnicode().a(var8, 0, var8.length);
                  if (var10.g.charAt(0) == '?') {
                     var10.g = var1.b.b + var10.g.substring(1);
                  }
               } else {
                  var10.g = Encoding.getUnicode().a(this.e, 20, var11 * 2);
               }
            }
         }
      } else {
         this.c.a(-2);
      }

   }

   private void k() throws Exception {
      this.a.a(this.c);
      this.e = this.a.a();
      this.f = this.a.b();
   }

   private void l() throws Exception {
      this.a.a(this.c, this.d & '\uffff');
      this.e = this.a.a();
   }
}
